import { reqUserAddressList, reqOrderInfo } from '@/api/index.js'

const state = {
    userAddress: [],
    orderList: {}
}
const mutations = {
    GETUSERADDRESS(state, val) {
        state.userAddress = val
    },
    GETORDERLIST(state, val) {
        state.orderList = val
    }
}
const actions = {
    async getUserAddress(context) {
        const res = await reqUserAddressList()
        if (res.code == 200) {
            context.commit('GETUSERADDRESS', res.data)
        }
    },
    async getOrderList(context) {
        const res = await reqOrderInfo()
        if (res.code == 200) {
            context.commit('GETORDERLIST', res.data)
        }
    }
}
const getters = {}

export default {
    state,
    mutations,
    actions,
    getters
}